package org.wdcode.back.po;

import java.io.Serializable;

import org.wdcode.back.helper.MenuHelper;
import org.wdcode.common.tools.Conversion;
import org.wdcode.common.util.CommonUtil;

/**
 * 菜单实体
 * @author WD
 * @since JDK6
 * @version 1.0 2009-11-23
 */
public final class Menu extends BaseBackStateEntityBean implements Serializable {
	// 序列化ID
	private static final long	serialVersionUID	= -1221717566590951843L;

	// 上级菜单ID
	private Integer				menuId;
	// 上级菜单
	private Menu				menu;

	/**
	 * 获得上级菜单ID
	 * @return 上级菜单ID
	 */
	public Integer getMenuId() {
		return menuId;
	}

	/**
	 * 设置上级菜单ID
	 * @param menuId 上级菜单ID
	 */
	public void setMenuId(Integer menuId) {
		this.menuId = menuId;
	}

	/**
	 * 获得上级菜单
	 * @return 上级菜单
	 */
	public Menu getMenu() {
		return CommonUtil.isEmpty(menu) ? MenuHelper.getHelper().get(Conversion.toInt(menuId)) : menu;
	}
}
